// 引入数据模型
const { Category } = require("../model/index")

/**
 * 获取全部类别
 * @returns -> Array
 */
exports.getAllCategory = async function () {
  const result = await Category.findAll()
  return result
}

/**
 * 获取单独类别
 * @returns -> Object
 */
exports.getCategory = async function (id) {
  const result = await Category.findOne({
    where: {
      id
    }
  })
  return result
}
